<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>离线地图</title>
    <style type="text/css">
        html{height:100%}
        body{height:100%;margin:0px;padding:0px}
        #container{height:100%}
    </style>
    <script type="text/javascript" src="js/apiv2.0.min.js">
    </script>
</head>

<body>
<!-- 1XjLLEhZhQNUzd93EjU5nOGQ -->
<div id="container"></div>
<script type="text/javascript">

    var outputPath = 'tiles/';    //地图瓦片所在的文件夹
    var fromat = ".png";    //格式

    var tileLayer = new BMap.TileLayer();
    tileLayer.getTilesUrl = function (tileCoord, zoom) {
        var x = tileCoord.x;
        var y = tileCoord.y;
        var url = outputPath + zoom + '/' + x + '/' + y + fromat;
        return url;
    }
    var tileMapType = new BMap.MapType('tileMapType', tileLayer);

    var map = new BMap.Map("container", { mapType: tileMapType ,minZoom:7,maxZoom:15});

    //var map = new BMap.Map("container");          // 创建地图实例
    var point = new BMap.Point(108.94646555063274, 34.34726881662395);  // 创建点坐标
    map.centerAndZoom(point, 6);                 // 初始化地图，设置中心点坐标和地图级别
    map.enableScrollWheelZoom(true); // 允许缩放
    var bottom_left_control = new BMap.ScaleControl({anchor: BMAP_ANCHOR_BOTTOM_LEFT});// 左上角，添加比例尺
    var top_right_navigation = new BMap.NavigationControl({anchor: BMAP_ANCHOR_TOP_RIGHT, type: BMAP_NAVIGATION_CONTROL_SMALL}); //右上角，仅包含平移和缩放按钮
    map.addControl(bottom_left_control);
    map.addControl(top_right_navigation);

</script>
</body>
</html>
